﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using DevExpress.XtraGrid.Views.Grid;

namespace ERP_RORZE_PRODUCT.Product.XLBM
{
    public partial class testctrl : DevExpress.XtraEditors.XtraUserControl
    {
        ClsBasicListDAO clsDAO = new ClsBasicListDAO();
        DataTable dt;

        public testctrl()
        {
            InitializeComponent();
        }

        private void testctrl_Load(object sender, EventArgs e)
        {
            dt = clsDAO.GetAllExpence();
            gridControl1.DataSource = dt;
            
        }

        private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            GridView view = sender as GridView;
            //Kiểm tra đây là dòng dữ liệu mới hay cũ, nếu là mới thì mình insert
            if (view.IsNewItemRow(e.RowHandle))
            {
                MessageBox.Show("dữ liệu mới");
            }
            //Cũ thì update
            else
            {
                MessageBox.Show("dữ liệu sửa");

            }
        }

        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            //MessageBox.Show("chuyển");
        }
    }
}
